from building import *
import os

cwd     = GetCurrentDir()
path = [cwd]
src  = []

src += [cwd + '/user_lib/user_lib.c']
path += [cwd + '/user_lib']

if GetDepend(['BSP_USING_PID']):
    src += [cwd + '/pid/pid.c']
    path += [cwd + '/pid']

if GetDepend(['BSP_USING_QUATERNIONESF']):
    src += [cwd + '/QuaternionEKF/QuaternionEKF.c']
    path += [cwd + '/QuaternionEKF']

if GetDepend(['BSP_USING_KALMAN_FILTER']):
    src += [cwd + '/kalman_filter/kalman_filter.c']
    path += [cwd + '/kalman_filter']

if GetDepend(['BSP_USING_RAMP']):
    src += [cwd + '/ramp/ramp.c']
    path += [cwd + '/ramp']

#  使用 arm_math.h 需要添加相关内核定义
CPPDEFINES = ['ARM_MATH_CM4']
LIBPATH = [cwd + '/arm_math']
LIBS = ['libarm_cortexM4lf_math.a']
path += [cwd + '/arm_math']

group = DefineGroup('RM_Algorithms', src, depend = [''], CPPPATH = path, CPPDEFINES = CPPDEFINES, LIBS = LIBS, LIBPATH=LIBPATH)

Return('group')
